﻿using System;
using System.Web.UI.WebControls;

namespace MyLib.Web.UI {
	/// <summary>
	/// 
	/// </summary>
	public class MyDropDownList : DropDownList {
		/// <summary>
		/// 
		/// </summary>
		public override string SelectedValue {
			get {
				return base.SelectedValue;
			}
			set {
				base.EnsureDataBound();

				var flag = false;
				foreach (ListItem item in Items) {
					if (item.Value == value)
						flag = true;
				}

				if (flag)
					base.SelectedValue = value;
			}
		}
	} // end of MyDropDownList.
}
